/*
 * @Author: zhang zhijiang 2824735304@qq.com
 * @Date: 2024-12-06 21:44:32
 * @LastEditors: zhang zhijiang 2824735304@qq.com
 * @LastEditTime: 2024-12-09 19:44:47
 * @FilePath: /linux/test_12_6/comman.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#define mpath "./myfifo"
#define mode 0664
using namespace std;
enum
{
    mkfifo_err = 1,
    open_error,
    read_error
};
class init
{public:
    init()
    {
        int n =  mkfifo(mpath,mode);//创建命名管道
   if(n!=0)
   {
    perror("mkfifo");
    exit(mkfifo_err);
   }
    }
    ~init()
    {
   unlink(mpath);
    }
};